package com.bjlytr.license.client.config;

import com.bjlytr.license.client.intercetor.LicenseCheckInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author Ledison
 * @date 2021/9/17
 */
@Configuration
public class InterceptorAdapterConfig extends WebMvcConfigurerAdapter {

    @Autowired
    private LicenseCheckInterceptor licenseCheckInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册自己的拦截器并设置拦截的请求路径
        registry.addInterceptor(licenseCheckInterceptor).addPathPatterns("/**");
        super.addInterceptors(registry);
    }
}
